package com.ruoyi.project.lely.bean.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDate;
import java.time.LocalDateTime;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;

/**
 * 用户
 *
 * @author luoyong
 */
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Data
@TableName(value = "`ly_user`", autoResultMap = true)
public class LyUser {


    @ApiModelProperty("ID")
    @TableId(value = "id",type = IdType.AUTO)
    private Long id;


    @Length(max = 63, message = "用户名称长度不能超过63位")
    @NotEmpty
    @ApiModelProperty("用户名称")
    @TableField(value = "`username`")
    private String username;


    @Length(max = 63, message = "用户密码长度不能超过63位")
    @NotEmpty
    @ApiModelProperty("用户密码")
    @TableField(value = "`password`")
    private String password;


    @NotNull
    @ApiModelProperty("性别：0 未知， 1男， 1 女")
    @TableField(value = "`gender`")
    private Integer gender;


    @ApiModelProperty("生日")
    @TableField(value = "`birthday`")
    private LocalDate birthday;


    @ApiModelProperty("最近一次登录时间")
    @TableField(value = "`last_login_time`")
    private LocalDateTime lastLoginTime;


    @Length(max = 63, message = "最近一次登录IP地址长度不能超过63位")
    @NotEmpty
    @ApiModelProperty("最近一次登录IP地址")
    @TableField(value = "`last_login_ip`")
    private String lastLoginIp;


    @ApiModelProperty("用户层级 0 普通用户，1 VIP用户，2 区域代理用户")
    @TableField(value = "`user_level`")
    private Integer userLevel;


    @Length(max = 63, message = "用户昵称或网络名称长度不能超过63位")
    @NotEmpty
    @ApiModelProperty("用户昵称或网络名称")
    @TableField(value = "`nickname`")
    private String nickname;


    @Length(max = 20, message = "用户手机号码长度不能超过20位")
    @NotEmpty
    @ApiModelProperty("用户手机号码")
    @TableField(value = "`mobile`")
    private String mobile;


    @Length(max = 255, message = "用户头像图片长度不能超过255位")
    @NotEmpty
    @ApiModelProperty("用户头像图片")
    @TableField(value = "`avatar`")
    private String avatar;


    @Length(max = 63, message = "微信登录openid长度不能超过63位")
    @NotEmpty
    @ApiModelProperty("微信登录openid")
    @TableField(value = "`weixin_openid`")
    private String weixinOpenid;


    @NotNull
    @ApiModelProperty("0 可用, 1 禁用, 2 注销")
    @TableField(value = "`status`")
    private Integer status;


    @ApiModelProperty("创建时间")
    @TableField(value = "`create_time`", fill = FieldFill.INSERT)
    private LocalDateTime createTime;


    @ApiModelProperty("更新时间")
    @TableField(value = "`update_time`", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;


    @ApiModelProperty("逻辑删除")
    @TableField(value = "`deleted`", fill = FieldFill.INSERT)
    private Integer deleted;


    @ApiModelProperty("积分、分数")
    @TableField(value = "`fraction`")
    private Integer fraction;

}
